package com.itheima.tanhua.server.controller;

import com.github.pagehelper.PageHelper;
import com.itheima.tanhua.dubbo.api.UserService;
import com.itheima.tanhua.model.vo.Recommendation;
import com.itheima.tanhua.model.vo.RecommendationVo;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("tanhua")
public class TanhuaController {
    @DubboReference
    private UserService userService;

    @GetMapping("/recommendation")
    public List<RecommendationVo> getRecommendationVoList(@RequestHeader("Authorization") String authorization, Recommendation recommendation) {
        //设置分页
        PageHelper.startPage(recommendation.getPage(),recommendation.getPagesize());

        return userService.getRecommendationVoList(recommendation.getAge(),recommendation.getCity());
    }
}
